import unittest
from selenium import webdriver
import time
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By

from Page import Page
from ddt import ddt,file_data

@ddt
class TestCase(unittest.TestCase):
    def setUp(self,):
        self.driver=webdriver.Edge()
        self.driver.maximize_window()
        

    def tearDown(self):
        time.sleep(3)
        self.driver.quit()

    @file_data('yaml.yaml')
    def test_01_sou(self,username,password,duan):
        po=Page(self.driver)
        po.open_url('http://localhost:8080/yklogin1')
        po.username(username)
        po.password(password)
        po.login()
        po.que()
        time.sleep(2)
        alert = self.driver.switch_to.alert
        text = alert.text
        self.assertEqual(text,duan)
        print(duan)
        time.sleep(2)
        po.du()
        po.sou()






if __name__ == '__main__':
    unittest.main()
